3.395 \(\int x \cos (2 x) \sec (x) \, dx\)

Optimal. Leaf size=57 \[ -i \text {Li}_2\left (-i e^{i x}\right )+i \text {Li}_2\left (i e^{i x}\right )+2 x \sin (x)+2 \cos (x)+2 i x \tan ^{-1}\left (e^{i x}\right ) \]

[Out]

2*I*x*arctan(exp(I*x))+2*cos(x)-I*polylog(2,-I*exp(I*x))+I*polylog(2,I*exp(I*x))+2*x*sin(x)

________________________________________________________________________________________

Rubi [A]  time = 0.07, antiderivative size = 57, normalized size of antiderivative = 1.00, number of steps used = 12, number of rules used = 7, integrand size = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.875, Rules used = {4431, 3296, 2638, 4407, 4181, 2279, 2391} \[ -i \text {PolyLog}\left (2,-i e^{i x}\right )+i \text {PolyLog}\left (2,i e^{i x}\right )+2 x \sin (x)+2 \cos (x)+2 i x \tan ^{-1}\left (e^{i x}\right ) \]

Antiderivative was successfully verified.

[In]

Int[x*Cos[2*x]*Sec[x],x]

[Out]

(2*I)*x*ArcTan[E^(I*x)] + 2*Cos[x] - I*PolyLog[2, (-I)*E^(I*x)] + I*PolyLog[2, I*E^(I*x)] + 2*x*Sin[x]

Rule 2279

Int[Log[(a_) + (b_.)*((F_)^((e_.)*((c_.) + (d_.)*(x_))))^(n_.)], x_Symbol] :> Dist[1/(d*e*n*Log[F]), Subst[Int
[Log[a + b*x]/x, x], x, (F^(e*(c + d*x)))^n], x] /; FreeQ[{F, a, b, c, d, e, n}, x] && GtQ[a, 0]

Rule 2391

Int[Log[(c_.)*((d_) + (e_.)*(x_)^(n_.))]/(x_), x_Symbol] :> -Simp[PolyLog[2, -(c*e*x^n)]/n, x] /; FreeQ[{c, d,
 e, n}, x] && EqQ[c*d, 1]

Rule 2638

Int[sin[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Cos[c + d*x]/d, x] /; FreeQ[{c, d}, x]

Rule 3296

Int[((c_.) + (d_.)*(x_))^(m_.)*sin[(e_.) + (f_.)*(x_)], x_Symbol] :> -Simp[((c + d*x)^m*Cos[e + f*x])/f, x] +
Dist[(d*m)/f, Int[(c + d*x)^(m - 1)*Cos[e + f*x], x], x] /; FreeQ[{c, d, e, f}, x] && GtQ[m, 0]

Rule 4181

Int[csc[(e_.) + Pi*(k_.) + (f_.)*(x_)]*((c_.) + (d_.)*(x_))^(m_.), x_Symbol] :> Simp[(-2*(c + d*x)^m*ArcTanh[E
^(I*k*Pi)*E^(I*(e + f*x))])/f, x] + (-Dist[(d*m)/f, Int[(c + d*x)^(m - 1)*Log[1 - E^(I*k*Pi)*E^(I*(e + f*x))],
 x], x] + Dist[(d*m)/f, Int[(c + d*x)^(m - 1)*Log[1 + E^(I*k*Pi)*E^(I*(e + f*x))], x], x]) /; FreeQ[{c, d, e,
f}, x] && IntegerQ[2*k] && IGtQ[m, 0]

Rule 4407

Int[((c_.) + (d_.)*(x_))^(m_.)*Sin[(a_.) + (b_.)*(x_)]^(n_.)*Tan[(a_.) + (b_.)*(x_)]^(p_.), x_Symbol] :> -Int[
(c + d*x)^m*Sin[a + b*x]^n*Tan[a + b*x]^(p - 2), x] + Int[(c + d*x)^m*Sin[a + b*x]^(n - 2)*Tan[a + b*x]^p, x]
/; FreeQ[{a, b, c, d, m}, x] && IGtQ[n, 0] && IGtQ[p, 0]

Rule 4431

Int[((e_.) + (f_.)*(x_))^(m_.)*(F_)[(a_.) + (b_.)*(x_)]^(p_.)*(G_)[(c_.) + (d_.)*(x_)]^(q_.), x_Symbol] :> Int
[ExpandTrigExpand[(e + f*x)^m*G[c + d*x]^q, F, c + d*x, p, b/d, x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && M
emberQ[{Sin, Cos}, F] && MemberQ[{Sec, Csc}, G] && IGtQ[p, 0] && IGtQ[q, 0] && EqQ[b*c - a*d, 0] && IGtQ[b/d,
1]

Rubi steps

\begin {align*} \int x \cos (2 x) \sec (x) \, dx &=\int (x \cos (x)-x \sin (x) \tan (x)) \, dx\\ &=\int x \cos (x) \, dx-\int x \sin (x) \tan (x) \, dx\\ &=x \sin (x)+\int x \cos (x) \, dx-\int x \sec (x) \, dx-\int \sin (x) \, dx\\ &=2 i x \tan ^{-1}\left (e^{i x}\right )+\cos (x)+2 x \sin (x)+\int \log \left (1-i e^{i x}\right ) \, dx-\int \log \left (1+i e^{i x}\right ) \, dx-\int \sin (x) \, dx\\ &=2 i x \tan ^{-1}\left (e^{i x}\right )+2 \cos (x)+2 x \sin (x)-i \operatorname {Subst}\left (\int \frac {\log (1-i x)}{x} \, dx,x,e^{i x}\right )+i \operatorname {Subst}\left (\int \frac {\log (1+i x)}{x} \, dx,x,e^{i x}\right )\\ &=2 i x \tan ^{-1}\left (e^{i x}\right )+2 \cos (x)-i \text {Li}_2\left (-i e^{i x}\right )+i \text {Li}_2\left (i e^{i x}\right )+2 x \sin (x)\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.03, size = 77, normalized size = 1.35 \[ -i \left (\text {Li}_2\left (-i e^{i x}\right )-\text {Li}_2\left (i e^{i x}\right )\right )-x \left (\log \left (1-i e^{i x}\right )-\log \left (1+i e^{i x}\right )\right )+2 x \sin (x)+2 \cos (x) \]

Antiderivative was successfully verified.

[In]

Integrate[x*Cos[2*x]*Sec[x],x]

[Out]

2*Cos[x] - x*(Log[1 - I*E^(I*x)] - Log[1 + I*E^(I*x)]) - I*(PolyLog[2, (-I)*E^(I*x)] - PolyLog[2, I*E^(I*x)])
+ 2*x*Sin[x]

________________________________________________________________________________________

fricas [B]  time = 1.23, size = 106, normalized size = 1.86 \[ -\frac {1}{2} \, x \log \left (i \, \cos \relax (x) + \sin \relax (x) + 1\right ) + \frac {1}{2} \, x \log \left (i \, \cos \relax (x) - \sin \relax (x) + 1\right ) - \frac {1}{2} \, x \log \left (-i \, \cos \relax (x) + \sin \relax (x) + 1\right ) + \frac {1}{2} \, x \log \left (-i \, \cos \relax (x) - \sin \relax (x) + 1\right ) + 2 \, x \sin \relax (x) + 2 \, \cos \relax (x) + \frac {1}{2} i \, {\rm Li}_2\left (i \, \cos \relax (x) + \sin \relax (x)\right ) + \frac {1}{2} i \, {\rm Li}_2\left (i \, \cos \relax (x) - \sin \relax (x)\right ) - \frac {1}{2} i \, {\rm Li}_2\left (-i \, \cos \relax (x) + \sin \relax (x)\right ) - \frac {1}{2} i \, {\rm Li}_2\left (-i \, \cos \relax (x) - \sin \relax (x)\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*cos(2*x)*sec(x),x, algorithm="fricas")

[Out]

-1/2*x*log(I*cos(x) + sin(x) + 1) + 1/2*x*log(I*cos(x) - sin(x) + 1) - 1/2*x*log(-I*cos(x) + sin(x) + 1) + 1/2
*x*log(-I*cos(x) - sin(x) + 1) + 2*x*sin(x) + 2*cos(x) + 1/2*I*dilog(I*cos(x) + sin(x)) + 1/2*I*dilog(I*cos(x)
 - sin(x)) - 1/2*I*dilog(-I*cos(x) + sin(x)) - 1/2*I*dilog(-I*cos(x) - sin(x))

________________________________________________________________________________________

giac [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int x \cos \left (2 \, x\right ) \sec \relax (x)\,{d x} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*cos(2*x)*sec(x),x, algorithm="giac")

[Out]

integrate(x*cos(2*x)*sec(x), x)

________________________________________________________________________________________

maple [A]  time = 0.06, size = 66, normalized size = 1.16 \[ x \ln \left (1+i {\mathrm e}^{i x}\right )-x \ln \left (1-i {\mathrm e}^{i x}\right )-i \dilog \left (1+i {\mathrm e}^{i x}\right )+i \dilog \left (1-i {\mathrm e}^{i x}\right )+2 \cos \relax (x )+2 x \sin \relax (x ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(x*cos(2*x)*sec(x),x)

[Out]

x*ln(1+I*exp(I*x))-x*ln(1-I*exp(I*x))-I*dilog(1+I*exp(I*x))+I*dilog(1-I*exp(I*x))+2*cos(x)+2*x*sin(x)

________________________________________________________________________________________

maxima [F]  time = 0.00, size = 0, normalized size = 0.00 \[ 2 \, x \sin \relax (x) + 2 \, \cos \relax (x) - 2 \, \int \frac {x \cos \left (2 \, x\right ) \cos \relax (x) + x \sin \left (2 \, x\right ) \sin \relax (x) + x \cos \relax (x)}{\cos \left (2 \, x\right )^{2} + \sin \left (2 \, x\right )^{2} + 2 \, \cos \left (2 \, x\right ) + 1}\,{d x} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*cos(2*x)*sec(x),x, algorithm="maxima")

[Out]

2*x*sin(x) + 2*cos(x) - 2*integrate((x*cos(2*x)*cos(x) + x*sin(2*x)*sin(x) + x*cos(x))/(cos(2*x)^2 + sin(2*x)^
2 + 2*cos(2*x) + 1), x)

________________________________________________________________________________________

mupad [B]  time = 2.21, size = 46, normalized size = 0.81 \[ 2\,\cos \relax (x)+2\,x\,\sin \relax (x)-\mathrm {polylog}\left (2,-{\mathrm {e}}^{x\,1{}\mathrm {i}}\,1{}\mathrm {i}\right )\,1{}\mathrm {i}+\mathrm {polylog}\left (2,{\mathrm {e}}^{x\,1{}\mathrm {i}}\,1{}\mathrm {i}\right )\,1{}\mathrm {i}+x\,\mathrm {atan}\left ({\mathrm {e}}^{x\,1{}\mathrm {i}}\right )\,2{}\mathrm {i} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((x*cos(2*x))/cos(x),x)

[Out]

2*cos(x) - polylog(2, -exp(x*1i)*1i)*1i + polylog(2, exp(x*1i)*1i)*1i + x*atan(exp(x*1i))*2i + 2*x*sin(x)

________________________________________________________________________________________

sympy [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int x \cos {\left (2 x \right )} \sec {\relax (x )}\, dx \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*cos(2*x)*sec(x),x)

[Out]

Integral(x*cos(2*x)*sec(x), x)

________________________________________________________________________________________